package com.barcamp.test;

import static org.junit.Assert.assertFalse;

import java.util.List;

import org.apache.log4j.Logger;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

import com.barcamp.entity.RegisterData;
import com.barcamp.manager.RegisterManager;
import com.exception.PersistenceException;


public class RegisterTestCase {
	 private static Logger logger = Logger.getLogger(RegisterTestCase.class);
	 private static RegisterManager registerManager;
	 private RegisterData registerData = new RegisterData();
	 
	 @BeforeClass
	    public static void init(){
	      logger.info("RegisterTest is started...........");
	      XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("spring-beans.xml"));
	      registerManager = (RegisterManager)factory.getBean("RegisterManager");
	      logger.info("RegisterManager instance has been loaded.");
	    }
	  
	    @AfterClass
	    public static void finished(){
	      logger.info("RegisterManager has been finished...........................");
	    }
	    
//	    @Test
//	    public void registerAttendance() throws PersistenceException{
//	    	registerData.setName("Thein Tein");
//	    	registerData.setEventId(1);
//	    	registerData.setEmailAddress("soesoe@gmail.com");
//	    	registerManager.registerAttendance(registerData);
//	    }
//	    
//	    @Test
//	    public void updateBooklist(){
//	    	booklist.setBookTitle("Alfresco");
//	    	booklist.setAuthorName("Khine");
//	    	booklist.setPublishDate("4/5/2011");
//	    	booklist.setPrice("500");
//	    	elibraryManager.updateBooklist(booklist);
//	    }
	    @Test
	    public void findAllUser() throws PersistenceException{
	    	
	    	List<RegisterData> result =registerManager.findByPresentStatus(1);
			assertFalse(result.isEmpty());
	    }
	    public static void main(String args[]){
	    	org.junit.runner.JUnitCore.main(RegisterTestCase.class.getName());
	    }
}
